package com.manor.main.adapter;


import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.manor.main.R;
import com.manor.main.bean.QuickRechargeBean;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class QuickRechargeAdapter extends BaseQuickAdapter<QuickRechargeBean.RulesBean, BaseViewHolder> {

    private IAddListListener listener;//声明成员变量

    public interface IAddListListener {//创建抽象类

        void deleteBank();//添加抽象方法，可任意添加多个可带参数如void test(String cibtext);往下加就行
    }

    public QuickRechargeAdapter(int layoutResId, @Nullable List<QuickRechargeBean.RulesBean> data) {
        super(layoutResId, data);

    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, QuickRechargeBean.RulesBean item) {

        TextView tv_zs = helper.getView(R.id.tv_zs);
        TextView tv_coin = helper.getView(R.id.tv_coin);
        TextView tv_money = helper.getView(R.id.tv_money);
        LinearLayout ll_quick_btn = helper.getView(R.id.ll_quick_btn);

        if (item.getGive().equals("")||item.getGive().equals("0")) {
            tv_zs.setVisibility(View.GONE);
        } else {
            if(item.getId().equals("7")){
                tv_zs.setText("首充赠送"+item.getGive()+"糖果");
            }else
            tv_zs.setText("赠送"+item.getGive()+"糖果");
        }
        tv_coin.setText(item.getCoin());
        tv_money.setText("¥"+item.getMoney());
        if(item.getIs_select().equals("1")){
            ll_quick_btn.setBackgroundResource(R.drawable.bg_recharge_btn);
        }else {
            ll_quick_btn.setBackgroundResource(R.drawable.bg_recharge_wx_btn);
        }

    }


}